<!--apps/frontend/modules/templates/editSuccess.php-->
<h2>Edit Event</h2>

<form action="<?php echo url_for('@submit') ?>" method="post">
    <?php echo $form->renderHiddenFields() ?>
    <?php echo $form['title']->renderLabel() ?> <?php echo $form['title']->renderError() ?> <?php echo $form['title'] ?>

    <ul>
        <?php foreach ($form['Occurrences'] as $occurrence): ?>
            <li>
            <?php echo $occurrence['date']->renderLabel() ?>  <?php echo $occurrence['date']->renderError() ?>
            <?php echo $occurrence['date'] ?>
            -
            <?php echo $occurrence['location']->renderLabel() ?>  <?php echo $occurrence['location']->renderError() ?>
            <?php echo $occurrence['location'] ?>
        </li>
        <?php endforeach ?>
        <?php if ($form->getObject()->isNew()): ?>
                <script type="text/javascript">newfieldscount = 1;</script>
                <li>
            <?php echo $form['new'][0]['date']->renderLabel() ?>  <?php echo $form['new'][0]['date']->renderError() ?>
            <?php echo $form['new'][0]['date'] ?>
                -
            <?php echo $form['new'][0]['location']->renderLabel() ?>  <?php echo $form['new'][0]['location']->renderError() ?>
            <?php echo $form['new'][0]['location'] ?>
            </li>
        <?php endif ?>
            </ul>

            <a id="addoccurrence" href="#">Add an occurrence</a>

            <input type="submit" value="Save" />
        </form>

        <a href="<?php echo url_for('@homepage') ?>">Back to index</a>